package com.cpit.platform.common.utils;

import com.cpit.platform.common.entity.Result;

public class ResultUtil {


	public static <T> Result<T> success(T obj) {
		Result<T> result = new Result<T>();

		result.setCode(Result.CODE_SUCCESS);
		result.setMessage("success");
		result.setData(obj);

		return result;
	}
	
	
	public static <T> Result<T> success(){
		return success(null);
	}
	

	public static <T> Result<T> error(String code, String msg) {
		Result<T> result = new Result<T>();

		result.setCode(code);
		result.setMessage(msg);
		return result;
	}
	
	
	public static <T> Result<T> error(String code, String msg,T date) {
		Result<T> result = error(code,msg);
		result.setData(date);
		return result;
	}

}
